class code3 {
    //把1-n加入，再异或
    public int missingNumber(int[] nums) {
        int ret = 0;
        for(int i=0;i<nums.length;i++) {
            ret ^= (nums[i] ^ (i+1));
        }
        return ret;
    }
}